package com.hakim.wfb.biz;

import com.hakim.wfb.bean.ConsumeRecord;
import com.hakim.wfb.customer.params.trans.ConsumeRecordParameter;
import com.hakim.wfb.customer.params.trans.GetConsumeRecordParameter;
import com.hakim.wfb.customer.params.trans.GetTeamConsumeRecordParameter;
import com.hakim.wfb.customer.result.trans.TeamConsumeRecordView;
import com.hakim.wfb.dao.ConsumeRecordDao;
import java.math.BigDecimal;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Administrator on 2017/7/1.
 */
@Service("consumeRecordBiz")
public class ConsumeRecordBiz {

    @Autowired
    private ConsumeRecordDao consumeRecordDao;

    public ConsumeRecord getById(String id) {
        return consumeRecordDao.getById(id);
    }

    public void add(ConsumeRecord consumeRecord) {
        consumeRecordDao.add(consumeRecord);
    }

    public void update(ConsumeRecord consumeRecord) {
        consumeRecordDao.update(consumeRecord);
    }

    public int countInvestTimes(ConsumeRecordParameter param) {
        return consumeRecordDao.countInvestTimes(param);
    }

    public int countInvestTimesByUserId(String userId) {
        return consumeRecordDao.countInvestTimesByUserId(userId);
    }

    public List<ConsumeRecord> getFinishedConsumeRecords(GetConsumeRecordParameter param) {
        return consumeRecordDao.getFinishedConsumeRecords(param);
    }

    public List<ConsumeRecord> getRunningConsumeRecords(GetConsumeRecordParameter param) {
        return consumeRecordDao.getRunningConsumeRecords(param);
    }

    public int getFinishedConsumeRecordCount(GetConsumeRecordParameter param) {
        return consumeRecordDao.getFinishedConsumeRecordCount(param);
    }

    public int getRunningConsumeRecordCount(GetConsumeRecordParameter param) {
        return consumeRecordDao.getRunningConsumeRecordCount(param);
    }

    /**
     * @param parameter
     * @return
     */
    public List<ConsumeRecord> getUserConsumeRecords(GetConsumeRecordParameter parameter) {
        return consumeRecordDao.getUserConsumeRecords(parameter);
    }

    /**
     * @param parameter
     * @return
     */
    public int getUserConsumeRecordsCount(GetConsumeRecordParameter parameter) {
        return consumeRecordDao.getUserConsumeRecordsCount(parameter);
    }

    /**
     * @param parameter
     * @return
     */
    public List<TeamConsumeRecordView> getTeamConsumeRecords(
            GetTeamConsumeRecordParameter parameter) {
        return consumeRecordDao.getTeamConsumeRecords(parameter);
    }

    /**
     * @param parameter
     * @return
     */
    public int getTeamConsumeRecordsCount(GetTeamConsumeRecordParameter parameter) {
        return consumeRecordDao.getTeamConsumeRecordsCount(parameter);
    }

    /**
     * 用户投资中总额
     */
    public BigDecimal getUserInvestingAmount(String userId) {
        return consumeRecordDao.getUserInvestingAmount(userId);
    }

    /**
     * 团队投资中总额
     */
    public BigDecimal getTeamInvestingAmount(String userOrg) {
        return consumeRecordDao.getTeamInvestingAmount(userOrg);
    }
}
